package com.iwayin.core.common;

import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import com.iwayin.core.utils.Base64;
import com.iwayin.core.utils.DateTimeUtil;

public class SimpleJob extends java.util.TimerTask{
	@Override
	public void run() {
		Map<String, String> map = Constants.statusMap;
		Set<String> keyValues = map.keySet();
		Iterator<String> keyValue = keyValues.iterator();
		while (keyValue.hasNext()) {
			String valueStr = new String(Base64.decode(map.get(keyValue.next())));
			Date d = DateTimeUtil.getFormatDate(valueStr.split(";")[1], DateTimeUtil.TIME_FORMAT);
			Long time = new Date().getTime() - d.getTime();
			if (time / (1000 * 3600) > 48) {
				map.remove(keyValue.next());
			}
		}
	}
}
